- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 870
feat: realtime #1402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
                
     Merged
            
            feat: realtime #1402
Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | 🦋 Changeset detectedLatest commit: 85e8f47 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
 Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR | 
b70cf3d    to
    0c5dcd8      
    Compare
  
    | @trigger.dev/build
 trigger.dev
 @trigger.dev/core
 @trigger.dev/sdk
 @trigger.dev/react-hooks
 commit:  | 
| New things that need to be tested:
 Changes that need to be tested
 | 
also updated electric to latest version
…ter triggering a task
…WT read access to the tags when using trigger
c5379f8    to
    a19baa0      
    Compare
  
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Trigger.dev realtime - powered by electric
Realtime gives you the ability to subscribe to the state of your task runs from:
@trigger.dev/react-hookspackage, along with a new "public token" permission system powered by JWTsSubscribing from your server
You can use our existing SDK to subscribe to changes to a specific run like so:
Or you can subscribe to all runs that match a certain tag like so:
Realtime requests aren't counted against the normal API rate-limit requests, but there can be limits on the number of "live" concurrent realtime requests instead.
Subscribing from your frontend
Using our
@trigger.dev/react-hookspackage, you can subscribe to runs and tags in your react frontend:Granting permissions to your frontend is done by generating a "public token" from your server, and passing it to the frontend:
Then in your frontend, you can use our
TriggerAuthContext.Providercomponent to provide the public token to your components, which will get used by our hooks:And more!
Run metadata changes
We've made changes to how the run metadata SDK works. Previously, each call to update/save the run metadata made a call to the server to update the value. We've changed this to be much more like logs, where all calls are synchronous and updates are buffered and flushed to the server periodically. This allows you to call
metadata.setandmetadata.replace(which is whatmetadata.savehas been changed to) as many times as you want without bombarding the server and slowing down your runs.We've also added the ability to "set" deeply inside an object using JSON paths:
Schema Tasks
We have a new way of defining a task that takes a schema to parse and infer the payload type:
This will work with the following schema libraries:
Increasing tag limits
Run tags can now be up to 128 characters and each run can now have up to 10 tags (instead of 5).